import request from "@/utils/request";

const apiUrl = {
  yinpuList: "/api/book/list",
  yinpuFacet: "/api/book/facet",
  yinzhangList: "/api/seal/list",
  yinzhangDetail: "/api/seal/detail/",
  yinzhangFacet: "/api/seal/facet",
  yinpuDetail: "/api/book/detail/",
  yinpuDetail2: "/api/book/detailByBookId/",
  zongluFacet: "/api/book/catalog/facet",
  zongluList: "/api/book/catalog/list",
  yinrenFacet: "/api/person/facet",
  yinrrenList: "/api/person/list",
  yinrenDetail: "/api/person/detail/",
  laiyuanList: "/api/book/source/list",
  laiyuanDetail: "/api/book/source/detail/",
  yinrenSns: "/api/graph/person/",
  yinpuSns: "/api/graph/book/",
  yinzhangSns: "/api/graph/seal/",
  userIp: "/api/query/log/ip",
  logSave: "/api/action/log/save",
};

export function postData(name, data) {
  return request({
    url: apiUrl[name],
    method: "post",
    data,
  });
}

export function getData(name, id) {
  return request({
    url: apiUrl[name] + (id || ""),
    method: "get",
  });
}
